package es.antonio.controller.actions;

import org.springframework.binding.message.MessageBuilder;
import org.springframework.binding.message.MessageContext;
import org.springframework.stereotype.Component;
import org.springframework.webflow.execution.RequestContext;

import es.antonio.modelo.Persona;

@Component
public class LoginAction {

	public String login(RequestContext contexto, MessageContext messageContext) {

		System.out.println("flow: " + contexto.getActiveFlow().getId());

		messageContext.addMessage(new MessageBuilder().error()
				.defaultText("Error que lanzo desde action").build());

		return "ok";
	}

	public boolean persona(Persona persona) {
		System.out.println("persona: " + persona.getNombre());
		if (persona.getNombre() == null || persona.getNombre().equals(""))
			return false;

		return true;
	}
}
